<template>
  <router-view />
</template>

<script setup>
import { isMicroApp } from "@/microApp/utils.js";
import { setLocalCache } from "@/utils/cache.js";
import defaultConfig from "@/settings";
import useUserStore from "@/store/modules/user.js";
import useReceiveMainData from "@/hooks/microApp/useReceiveMainData.js";

if (isMicroApp()) {
  const userStore = useUserStore();
  const { userInfo, token, roles } = useReceiveMainData();
  userStore.userInfo = userInfo?.value || {};
  userStore.roles = roles?.value || [];
  setLocalCache(defaultConfig.tokenAttr, token?.value || "");
}
</script>

<style lang="scss">
#salesContract-app {
  height: 100%;
  font-weight: 400;
}

html,
body {
  margin: 0;
  padding: 0;
}

// TODO:全局button样式，后续封装
$--primary-color: #007dff;
.el-button:hover {
  color: inherit;
  background-color: inherit;
}
.el-button--primary {
  border: 1px solid $--primary-color;
}
.el-button--primary.is-plain {
  background-color: #fff;
  border: 1px solid $--primary-color;
}
.el-button--danger.is-plain {
  color: #ff3333;
  border: 1px solid #ff3333;
  background-color: #fff;
}
</style>
